<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>系统运行周报</title>
    <!--框架必需start-->
    <script type="text/javascript" src="../../libs/js/jquery.js"></script>
    <script type="text/javascript" src="../../libs/js/language/cn.js"></script>
    <script type="text/javascript" src="../../libs/js/framework.js"></script>
    <link href="../../libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" id="skin" prePath="../../"/>
    <link rel="stylesheet" type="text/css" id="customSkin"/>
    <!--框架必需end-->
    <link rel="stylesheet" type="text/css" href="../../sample_skin/demo/style/style.css"/>

    <script src="../../libs/js/table/quiGrid.js" type="text/javascript"></script>

    <!--基本选项卡start-->
    <script type="text/javascript" src="../../libs/js/nav/basicTab.js"></script>
    <!--基本选项卡end-->

    <!--self开始-->
    <link rel="stylesheet" href="../../assets/css/m_style.css" class="m_style">
    <script type="text/javascript" src="../../assets/js/m_main.js"></script>
    <!--self结束-->
</head>

<body>
<div class="m_pos">
    <img src="../../assets/images/position.png" alt="" class="m_position">
    <span>当前页面：</span>
    <span class="m_pos_local">系统运行周报</span>
</div>
<div class="page_content">
    <div class="m_wso_list">
        <p class="m_wso_name">系统运行周报</p>
        <div id="m_wso_table" style="text-align: center"></div>
    </div>
    <div class="infoCard infoCard2">
        <div class="m_lw_table">
            <p class="m_wso_look" id="date">2019年第39周周报预览</p>
            <div id="dataBasic" style="margin-top: 10px"></div>
        </div>
    </div>
</div>

<script type="text/javascript">

    var ctr="http://www.chinalightning.com.cn/api/Run_weekly/";


    var d1 = new Date();
    var d2 = new Date();
    d2.setMonth(0);
    d2.setDate(1);
    var rq = d1-d2;
    var s1 = Math.ceil(rq/(24*60*60*1000));
    var s2 = Math.ceil(s1/7);
    $("#date").html(d1.getFullYear()+"年第"+s2+"周周报预览");
    var gridData = {
        "form.paginate.pageNo": 1
    };
    $.get(ctr, function (res) {
        if (res!=400){
            var data=res.message;
            var res=[];
            data.forEach((value,key)=>{
                var convertData={};
                convertData.id=value["id"];
                convertData.area=value["区域"];
                convertData.scb_state=value["SCB状态"];
                convertData.spd_state=value["SPD状态"];
                convertData.check_date=value["检测日期"];
                convertData.set_date=value["安装日期"];
                convertData.serial_number=value["设备编号"];
                convertData.floor=value["楼层"];
                convertData.num=value["柜号"];
                convertData.sel=value["所选设备"];
                convertData.set_point=value["安装点"];
                convertData.line_state=value["在线状态"];
                res.push(convertData);
            })
            gridData.rows=res;
            initComplete();
        }else{
            top.Dialog.alert("当前无记录");

        }


    })


    var grid = null;


    //列表显示

    var gridData2 = {
        "form.paginate.pageNo": 1,
        "form.paginate.totalRows": 13,
        "rows": [{
            "ows_date":d1.getFullYear()+"年",
            "ows_week":"备注",
            "ows_tips":"第"+s2+"周 周报",
        }
        ]
    }

    function initComplete() {

        grid = $("#m_wso_table").quiGrid({
            columns: [{
                display: '日期',
                name: 'ows_date',
                width: "25%",
                cellClick: true
            }, {
                display: '周数',
                name: 'ows_week',
                width: "25%",
            },  {
                display: '备注',
                name: 'ows_tips',
                width: "25%",
            }
            ],
            data: gridData2,
            sortName: 'id',
            rownumbers: false,
            checkbox: false,
            height: '100%',
            width: "100%",
            pageSize: 10,
            percentWidthMode: true,
            // onAfterShowData: onAfterShowData,
        });
        $("#dataBasic").quiGrid({
            columns: [{
                display: 'ID',
                name: 'id',
                width: "6%",
                cellClick: true
            }, {
                display: 'SCB状态',
                name: 'scb_state',
                width: "7%",
                render: function (rowdata, rowindex, value, column) {
                    if ("off"==value){
                        return "<span style='color: red'>"+value+"</span>"
                    }else{
                        return value;
                    }
                }
            }, {
                display: '层SPD状态',
                name: 'spd_state',
                width: "7%",
                render: function (rowdata, rowindex, value, column) {
                    if ("off"==value){
                        return "<span style='color: red'>"+value+"</span>"
                    }else{
                        return value;
                    }
                }
            }, {
                display: '区域',
                name: 'area',
                width: "10%",
            }, {
                display: '在线状态',
                name: 'line_state',
                width: "8%",
                render: function (rowdata, rowindex, value, column) {
                    if ("off"==value){
                        return "<span style='color: red'>"+value+"</span>"
                    }else{
                        return value;
                    }
                }
            }, {
                display: '安装点',
                name: 'set_point',
                width: "10%",
            }, {
                display: '所选设备',
                name: 'sel',
                width: "10%",
            }, {
                display: '柜号',
                name: 'num',
                width: "6%",
            }, {
                display: '楼层',
                name: 'floor',
                width: "6%",
            }, {
                display: '设备编号',
                name: 'serial_number',
                width: "10%",
            }, {
                display: '安装日期',
                name: 'set_date',
                width: "10%",
            }, {
                display: '检测日期',
                name: 'check_date',
                width: "10%",
            }
            ],
            data: gridData,
            sortName: 'id',
            rownumbers: false,
            checkbox: false,
            height: '100%',
            width: "100%",
            pageSize: 10,
            percentWidthMode: true,
            // onAfterShowData: onAfterShowData,
        });
    }

    function onAfterShowData(data) {

        $("#dataBasic").find(".popupMenu").each(function () {
            $(this).hover(function () {
                $(this).find(".popupMenu_con").show();
            }, function () {
                $(this).find(".popupMenu_con").hide();
            });
        })
    }


    // 图标统计


</script>
</body>

</html>
